<?php
	include("initialize.php");
?>
<html>
<head>
	<title>GradeGrid - Account Settings</title>
	<?php include("header.php"); ?>
	<script type="text/javascript" language="javascript">
		function clean(){
			writeCopyright()
			try{
				showDates()
			} catch(e){
			}
		}
	</script>
</head>
<body onLoad="clean()">
	<div class="main">
		
		<?php include("boilerplate.php"); ?>
		<?php include("loginnavigation.php"); ?>
		<?php
			include("write_functions.php");
			connect("localhost", "root", "", "gradegriddatabase");
		?>
		
		<?php
			$hashkeys[0] = "personal";
			$hashkeys[1] = "school";
			$hashkeys[2] = "class";
			
			$pagelink_hash[$hashkeys[0]] = "Personal Settings";
			$pagelink_hash[$hashkeys[1]] = "School Settings";
			$pagelink_hash[$hashkeys[2]] = "Class Settings";
			
			$i = 0;
			$limit = count($pagelink_hash);
			
			while($i < $limit){
				$thiskey = $hashkeys[$i];
				$ph = $pagelink_hash[$thiskey];
				if($_GET["page"] == $hashkeys[$i]){
					echo "<span class='tab selected'>$ph</span>";
				} else{
					echo "<span class='tab'><a href='settings.php?page=$thiskey'>$ph</a></span>";
				}
				
				$i++;
			}
		?>
		<br /><br />
		<?php if($_SESSION["logged_in"]): ?>
			<div style="float: left; min-width: 50%;">
			<hr />
			<?php if($_GET["page"] == "class"): ?>
				<?php include("accountSettingsC.php"); ?>
			<?php elseif($_GET["page"] == "school"): ?>
				<?php include("accountSettingsS.php"); ?>
			<?php elseif($_GET["page"] == "personal"): ?>
				<?php include("accountSettingsP.php"); ?>
			<?php endif ?>

			
			</div>
		<?php else: ?>
			<?php executeFile("../files/access_error.txt"); ?>
		<?php endif ?>
	</div>
	<div id="copywright"></div>
</body>
</html>